package com.android.helloworld;



import android.app.Activity;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.CheckBox;
import android.widget.TextView;

public class HelloWorld extends Activity {
	private Button btn;
	private TextView tv;
	private CheckBox cb;
	private boolean b;
    /** Called when the activity is first created. */
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);
        btn = (Button)findViewById(R.id.Button01);
        tv = (TextView)findViewById(R.id.TextView01);
        cb = (CheckBox)findViewById(R.id.CheckBox01);
        b = true;
        btn.setOnClickListener(new OnClickListener(){

			public void onClick(View arg0) {
				// TODO Auto-generated method stub
				if (b)
					tv.setText(R.string.hello);
				else
					tv.setText(R.string.app_name);
				b = !b;
			}
        	
        });
        cb.setOnClickListener(new OnClickListener(){

			public void onClick(View v) {
				// TODO Auto-generated method stub
				if (cb.isChecked())
					cb.setText(R.string.ok);
				else
					cb.setText(R.string.no);
			}
        });
        
    }
}